1 <?php
2 function checkdetailsStudent(){
3     require
'conn.php';
4     $data=getMemberInfo();
5     $
group=$data['group'];
6     $name=$data[
'username'];
7     
if ($group=="students") {
8         # code...
9         $checkdetails=mysqli_query($con,
"SELECT * FROM membership_userrecords WHERE memberID='$name' AND tableName='student_details'");
10         $countcheck=mysqli_num_rows($checkdetails);
11         
if ($countcheck==0) {
12             # code...
13             echo
'<div class="alert alert-primary"><strong>Whats up '.$name.', Welcome to Jisort-your timetable companion.You need to provide your personal details to be able to get personalized content.Simply click <a href="student_details_view.php">HERE</a> to get started</strong></div>';
14         }
15     }
16 }
17 function datacounter($table){
18     require
'conn.php';
19     $result=mysqli_query($con,
"SELECT * FROM $table ORDER BY id");
20     $count=mysqli_num_rows($result);
21     echo $count;
22 }
23 function getclassestoday(){
24     require
'conn.php';
25     $today=date(
'D');
26     $user=getLoggedmemberID();
27     $getPkValue=mysqli_query($con,
"SELECT pkValue AS pk FROM membership_userrecords WHERE memberID='$user' AND tableName='student_details'");
28     
foreach ($getPkValue as $key => $value0) {
29         # code...loop
1
30         $storePk=$value0[
'pk'];
31     }
32     $getStudentDetails=mysqli_query($con,
"SELECT school AS st_school, department AS st_department, year_of_study AS st_yos FROM student_details WHERE id='$storePk'");
33     
foreach ($getStudentDetails as $key => $value1) {
34             # code...loop
2
35         $storeSchool=$value1[
'st_school'];
36         $storeDepartment=$value1[
'st_department'];
37         $storeYos=$value1[
'st_yos'];
38     }
39     $getclasses=mysqli_query($con,
"SELECT * FROM class_time_table WHERE day LIKE '$today%' AND school='$storeSchool' AND department='$storeDepartment' AND year_of_study='$storeYos'");
40             #count check here
41     $countcheck=mysqli_num_rows($getclasses);
42     
if ($countcheck==0) {
43         # code...
44         echo
'<div class="alert alert-success text-center">
45         <a href=
"#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
46         <b>Wubba lubba dub dub!! No
class today!!</b></div>';
47     }
48     
foreach ($getclasses as $key => $value2) {
49                 # code...loop
3
50         echo
'<tr>
51         <td>
'.$value2['unit_code'].'</td>
52         <td>
'.$value2['time_start'].'</td>
53         <td>
'.$value2['time_end'].'</td>
54         <td>
'.$value2['venue'].'</td>
55         </tr>
';
56     }
57 }
58 function getnotices(){
59     require
'conn.php';
60     $user=getLoggedmemberID();
61     $getPkValue=mysqli_query($con,
"SELECT pkValue AS pk FROM membership_userrecords WHERE memberID='$user' AND tableName='student_details'");
62     
foreach ($getPkValue as $key => $value0) {
63         # code...loop
1
64         $storePk=$value0[
'pk'];
65     }
66     $getStudentDetails=mysqli_query($con,
"SELECT school AS st_school, department AS st_department, year_of_study AS st_yos FROM student_details WHERE id='$storePk'");
67     
foreach ($getStudentDetails as $key => $value1) {
68             # code...loop
2
69         $storeSchool=$value1[
'st_school'];
70         $storeDepartment=$value1[
'st_department'];
71         $storeYos=$value1[
'st_yos'];
72     }
73     #pagination
74     $query=mysqli_query($con,
"select count(id) from `notices` where school='$storeSchool' and department='$storeDepartment' and year_of_study='$storeYos'");
75     $row = mysqli_fetch_row($query);
76
77     $rows = $row[
0];
78     
79     $page_rows =
6;#define number of rows per page
80
81     $last = ceil($rows/$page_rows);
82
83     
if($last < 1){
84         $last =
1;
85     }
86
87     $pagenum =
1;
88
89     
if(isset($_GET['pn'])){
90         $pagenum = preg_replace(
'#[^0-9]#', '', $_GET['pn']);
91     }
92
93     
if ($pagenum < 1) {
94         $pagenum =
1;
95     }
96     
else if ($pagenum > $last) {
97         $pagenum = $last;
98     }
99     #
set page limit here
100     $limit =
'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
101     #pagination
102     $bringnotices=mysqli_query($con,
"SELECT * FROM notices WHERE school='$storeSchool' AND department='$storeDepartment' AND year_of_study='$storeYos' ORDER BY id DESC $limit");
103     #start pagination controls here
104     
global $paginationCtrls;
105     $paginationCtrls =
'';
106
107     
if($last != 1){
108         
109         
if ($pagenum > 1) {
110         
//pagination controls
111             $previous = $pagenum -
1;
112             $paginationCtrls .=
'<a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'" class="btn btn-info btn-sm">Previous</a> &nbsp; &nbsp; ';
113
114             
for($i = $pagenum-4; $i < $pagenum; $i++){
115                 
if($i > 0){
116                 
//pagination controls
117                     $paginationCtrls .=
'<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'" class="btn btn-warning btn-sm">'.$i.'</a> &nbsp; ';
118                 }
119             }
120         }
121
122         $paginationCtrls .=
''.$pagenum.' &nbsp; ';
123
124         
for($i = $pagenum+1; $i <= $last; $i++){
125         
//pagination controls
126             $paginationCtrls .=
'<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'" class="btn btn-success btn-sm">'.$i.'</a> &nbsp; ';
127             
if($i >= $pagenum+4){
128                 
break;
129             }
130         }
131
132         
if ($pagenum != $last) {
133         
//pagination controls
134             $next = $pagenum +
1;
135             $paginationCtrls .=
' &nbsp; &nbsp; <a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'" class="btn btn-primary btn-sm">Next</a> ';
136         }
137     }#pagination controls end here
138     $countcheck=mysqli_num_rows($bringnotices);
139     
if ($countcheck==0) {
140         # code...
141         echo
'<div class="alert alert-warning text-center"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><b>You have no notices for now.</b></div>';
142     }
143     
foreach ($bringnotices as $key => $value2) {
144         # code...
145         $noticeID=$value2[
'id'];
146         $getowner=mysqli_query($con,
"SELECT memberID AS owner FROM membership_userrecords WHERE pkValue='$noticeID' AND tableName='notices'");
147         
foreach ($getowner as $key => $value3) {
148             # code...
149             $storeowner=$value3[
'owner'];
150         }
151         echo
'<a class="list-group-item list-group-item-action" href="#">
152         <div
class="media">
153         <div
class="media-body">
154         <strong><span
class="fa fa-user"></span>'.$storeowner.'</strong>-posted a new notice<br>
155         <p
class="img img-thumbnail">'.$value2['notice'].'</p>
156         <div
class="text-muted smaller">Date:'.$value2['date'].'</div>
157         </div>
158         </div>
159         </a>
';
160     }
161 }
162 function getmytasks(){
163     require
'conn.php';
164     $today=date(
'D');
165     $user=getLoggedmemberID();
166     $getmyposts=mysqli_query($con,
"SELECT pkValue AS ids FROM membership_userrecords WHERE memberID='$user' AND tableName='personal_time_table'");
167     
foreach ($getmyposts as $key => $value0) {
168         # code...
169         $storeID=$value0[
'ids'];
170     }
171     $gettasks=mysqli_query($con,
"SELECT * FROM personal_time_table WHERE day LIKE '$today%' AND id='$storeID'");
172     $countcheck=mysqli_num_rows($gettasks);
173     
if ($countcheck==0) {
174         # code...show message
if no tasks found
175         echo
'<div class="alert alert-info text-center">
176         <a href=
"#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
177         <b>Oopsie whoopsie,You have no tasks today.You can schedule some <a
class="btn btn-success btn-sm" href="personal_time_table_view.php">HERE</a></b></b></div>';
178     }
179     
foreach ($gettasks as $key => $value1) {
180         # code...
181         echo
'<tr>
182         <td>
'.$value1['activity'].'</td>
183         <td>
'.$value1['time_start'].'</td>
184         <td>
'.$value1['time_end'].'</td>
185         </tr>
';
186     }
187 }
188 function getexams(){
189     require
'conn.php';
190     $today=date(
'Y-m-d');
191     $user=getLoggedmemberID();
192     $getPkValue=mysqli_query($con,
"SELECT pkValue AS pk FROM membership_userrecords WHERE memberID='$user' AND tableName='student_details'");
193     
foreach ($getPkValue as $key => $value0) {
194         # code...loop
1
195         $storePk=$value0[
'pk'];
196     }
197     $getStudentDetails=mysqli_query($con,
"SELECT school AS st_school, department AS st_department, year_of_study AS st_yos FROM student_details WHERE id='$storePk'");
198     
foreach ($getStudentDetails as $key => $value1) {
199             # code...loop
2
200         $storeSchool=$value1[
'st_school'];
201         $storeDepartment=$value1[
'st_department'];
202         $storeYos=$value1[
'st_yos'];
203     }
204     $getexams=mysqli_query($con,
"SELECT * FROM exam_time_table WHERE date='$today' AND school='$storeSchool' AND department='$storeDepartment' AND year_of_study='$storeYos'");
205             #count check here
206     $countcheck=mysqli_num_rows($getexams);
207     
if ($countcheck==0) {
208         # code...
209         echo
'<div class="alert alert-success text-center">
210         <a href=
"#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
211         <b>Wubba lubba dub dub!! No exams today!!</b></div>
';
212     }
213     
foreach ($getexams as $key => $value2) {
214                 # code...loop
3
215         echo
'<tr>
216         <td>
'.$value2['unit_code'].'</td>
217         <td>
'.$value2['time_start'].'</td>
218         <td>
'.$value2['time_end'].'</td>
219         <td>
'.$value2['venue'].'</td>
220         </tr>
';
221     }
222 }
223 function classttlink(){
224     require
'conn.php';
225     $user=getLoggedmemberID();
226     $getPkValue=mysqli_query($con,
"SELECT pkValue AS pk FROM membership_userrecords WHERE memberID='$user' AND tableName='student_details'");
227     
foreach ($getPkValue as $key => $value0) {
228         # code...loop
1
229         $storePk=$value0[
'pk'];
230     }
231     $getStudentDetails=mysqli_query($con,
"SELECT school AS st_school, department AS st_department, year_of_study AS st_yos FROM student_details WHERE id='$storePk'");
232     
foreach ($getStudentDetails as $key => $value1) {
233             # code...loop
2
234         $storeSchool=$value1[
'st_school'];
235         $storeDepartment=$value1[
'st_department'];
236         $storeYos=$value1[
'st_yos'];
237     }
238     $getschoolName=mysqli_query($con,
"SELECT name sname FROM schools WHERE id='$storeSchool'");
239     
foreach ($getschoolName as $key => $valueSN) {
240         # code...
241         $storeSName=$valueSN[
'sname'];
242     }
243     $getdepartmentName=mysqli_query($con,
"SELECT name AS dname FROM departments WHERE id='$storeDepartment'");
244     
foreach ($getdepartmentName as $key => $valueDN) {
245         # code...
246         $storeDName=$valueDN[
'dname'];
247     }
248     echo
'class_time_table_view.php?SortField=&SortDirection=&FilterAnd%5B1%5D=and&FilterField%5B1%5D=7&FilterOperator%5B1%5D=equal-to&FilterValue%5B1%5D='.$storeSName.'&FilterAnd%5B2%5D=and&FilterField%5B2%5D=8&FilterOperator%5B2%5D=equal-to&FilterValue%5B2%5D='.$storeDName.'&FilterAnd%5B3%5D=and&FilterField%5B3%5D=9&FilterOperator%5B3%5D=equal-to&FilterValue%5B3%5D='.$storeYos.'';
249 }
250 function examttlink(){
251     require
'conn.php';
252     $user=getLoggedmemberID();
253     $getPkValue=mysqli_query($con,
"SELECT pkValue AS pk FROM membership_userrecords WHERE memberID='$user' AND tableName='student_details'");
254     
foreach ($getPkValue as $key => $value0) {
255         # code...loop
1
256         $storePk=$value0[
'pk'];
257     }
258     $getStudentDetails=mysqli_query($con,
"SELECT school AS st_school, department AS st_department, year_of_study AS st_yos FROM student_details WHERE id='$storePk'");
259     
foreach ($getStudentDetails as $key => $value1) {
260             # code...loop
2
261         $storeSchool=$value1[
'st_school'];
262         $storeDepartment=$value1[
'st_department'];
263         $storeYos=$value1[
'st_yos'];
264     }
265     $getschoolName=mysqli_query($con,
"SELECT name sname FROM schools WHERE id='$storeSchool'");
266     
foreach ($getschoolName as $key => $valueSN) {
267         # code...loop
3
268         $storeSName=$valueSN[
'sname'];
269     }
270     $getdepartmentName=mysqli_query($con,
"SELECT name AS dname FROM departments WHERE id='$storeDepartment'");
271     
foreach ($getdepartmentName as $key => $valueDN) {
272         # code... loop
4
273         $storeDName=$valueDN[
'dname'];
274     }
275     echo
'exam_time_table_view.php?SortField=&SortDirection=&FilterAnd%5B1%5D=and&FilterField%5B1%5D=7&FilterOperator%5B1%5D=equal-to&FilterValue%5B1%5D='.$storeSName.'&FilterAnd%5B2%5D=and&FilterField%5B2%5D=8&FilterOperator%5B2%5D=equal-to&FilterValue%5B2%5D='.$storeDName.'&FilterAnd%5B3%5D=and&FilterField%5B3%5D=9&FilterOperator%5B3%5D=equal-to&FilterValue%5B3%5D='.$storeYos.'';
276 }
277 ?>



Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL 112.234 lượt xem

Gõ tìm kiếm nhanh...